﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:converters="clr-namespace:SoftSource.Common.Converters;assembly=SoftSource.Common.Silverlight"
             x:Class="SoftSource.Controls.AutoGridEditorView"
             mc:Ignorable="d"
             d:DesignWidth="449"
             d:DesignHeight="364">
    
    <UserControl.Resources>
        <converters:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel HorizontalAlignment="Left"
                    Orientation="Horizontal">
            <Button Content="Add"
                    Margin="10,10,4,10"
                    Width="100"
                    Click="Add_Click" 
                    Visibility="{Binding Add, Converter={StaticResource ObjectToVisibilityConverter}}"/>
            <Button Content="Delete"
                    Margin="4,10,10,10"
                    Width="100"
                    Click="Delete_Click"
                    Visibility="{Binding Delete, Converter={StaticResource ObjectToVisibilityConverter}}" />
        </StackPanel>
        <data:DataGrid x:Name="AutoDataGrid"
                       ItemsSource="{Binding Values}"
                       AutoGenerateColumns="True"
                       Grid.Row="1" 
                       RowHeight="25" />
    </Grid>
</UserControl>